<jcpsm:pageContainer>
<c:if test="${not empty sessionScope.isUserLoggedIn && empty sessionScope.admin}">
	<jsp:forward page="/profile/home.jsp"></jsp:forward>
</c:if>
<c:if test="${empty sessionScope.isUserLoggedIn && empty sessionScope.admin}">
	<jsp:forward page="/index.jsp"></jsp:forward>
</c:if>
<div class="content">
<div class="">
<h1 class="title">Manage <span>Users</span></h1>
<c:if test="${not empty sessionScope.admin}">
		<c:if test="${not empty sessionScope.pendingUsers || not empty sessionScope.approvedUsers}">
		<table class="gridtable" width="90%" border="1" style="box-shadow: 5px 5px 8px #888888;">
		<tr align="center" class="fillgray">
					<td class="heading fillgray">Name/Oracle Id</td>
					<td class="heading fillgray">Designation</td>
					<td class="heading fillgray">PhoneNumber</td>
					<td class="heading fillgray">BuddyName</td>
					<td class="heading fillgray">PrimaryTrack</td>
					<td class="heading fillgray">Contact Info</td>
					<td class="heading fillgray">Email Id</td>
					<td class="heading" colspan="3"></td>
				</tr>
			<c:if test="${not empty sessionScope.pendingUsers}">
				<c:forEach var="userEntry" items="${sessionScope.pendingUsers}">
					<tr align="center">
					<td class="heading">${userEntry.value.name}</br>${users.oracleId}</td>
					<td class="heading">${userEntry.value.designation}</td>
					<td class="heading">${userEntry.value.phoneNumber}</td>
					<td class="heading">${userEntry.value.buddyName}</td>
					 <c:set var="primaryTrackId" value="${userEntry.value.primaryTrack}" />
					<td class="heading">${sessionScope.track[primaryTrackId].name}</td>
					<td class="heading">${userEntry.value.contactInfo}</td>
					<td class="heading">${userEntry.value.emailId}</td>
					<td class="heading"><a
							href="${contextRoot}/approveUser?emailId=${userEntry.value.emailId}" title="Approve"><img style="width:20px; height:20px;" src="${mediaRoot}/approve_icon.jpeg"/></a></td>
					<td class="heading"><a
							href="${contextRoot}/editUser?emailId=${userEntry.value.emailId}" title="Edit"><img src="${mediaRoot}/edit_icon.gif"/></a></td>
					<td class="heading"><a
							href="${contextRoot}/deleteUser?emailId=${userEntry.value.emailId}" title="Delete"><img src="${mediaRoot}/delete_icon.gif"/></a></td>
					</tr>
				</c:forEach>
			</c:if>
			<c:if test="${not empty sessionScope.approvedUsers}">
			<c:if test="${not empty sessionScope.pendingUsers}">
			<tr align="center">
					<td colspan="10" style="height: 3px" class="fillgray"></td>
			</tr>
			</c:if>
			<c:forEach var="userEntry" items="${sessionScope.approvedUsers}">
				<tr align="center">
					<td class="heading">${userEntry.value.name}</br>${users.oracleId}</td>
					<td class="heading">${userEntry.value.designation}</td>
					<td class="heading">${userEntry.value.phoneNumber}</td>
					<td class="heading">${userEntry.value.buddyName}</td>
					 <c:set var="primaryTrackId" value="${userEntry.value.primaryTrack}" />${trackId }
					<td class="heading">${sessionScope.track[primaryTrackId].name}</td>
					<td class="heading">${userEntry.value.contactInfo}</td>
					<td class="heading">${userEntry.value.emailId}</td>
					<td class="heading" colspan="2"><a
							href="${contextRoot}/editUser?emailId=${userEntry.value.emailId}" title="Edit"><img src="${mediaRoot}/edit_icon.gif"/></a></td>
					<td class="heading"><c:if test="${sessionScope.user.emailId != userEntry.value.emailId}">
 	 				<a href="${contextRoot}/deleteUser?emailId=${userEntry.value.emailId}" title="Delete"><img src="${mediaRoot}/delete_icon.gif"/></a>
 	 				</c:if></td>
 	 				</tr>
			</c:forEach>
			</c:if>
		</table>
	</c:if>
</c:if>
</div>
</div>
</jcpsm:pageContainer>